package com.kgc.scd.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kgc.scd.bean.ShopHotWords;
import com.kgc.scd.mapper.HotWordMapper;
import com.kgc.scd.service.ShopHotWordsService;
import com.kgc.scd.vo.ShopHotWordsVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class ShopHotWordsServiceimpl implements ShopHotWordsService {
   @Autowired(required = false)
   private HotWordMapper hotWordMapper;

    @Override
    public List<ShopHotWordsVO> getlist() {
        QueryWrapper<ShopHotWords>queryWrapper=new QueryWrapper<>();
        List<ShopHotWords>list= hotWordMapper.selectList(queryWrapper);
        List<ShopHotWordsVO>list1=list.stream().map(co->{
                ShopHotWordsVO shopHotWordsVO=new ShopHotWordsVO();
            BeanUtils.copyProperties(co,shopHotWordsVO);
            return shopHotWordsVO;
        }).collect(Collectors.toList());
        return list1;
    }
}
